const mongoose = require('mongoose');

const CommentSchema = mongoose.Schema({
    goods_id:String,
    from:String,
    //to:String,
    context:String,
    time:String
},{
  versionKey: false
});

 CommentSchema.statics = {
    fetch: function (cb) {
      return this
        .find({})
        .sort('meta.updateAt')
        .exec(cb);
    },
    findById: function (id, cb) {
      return this
        .findOne({_id: id})
        .exec(cb)
    }
};

module.exports = CommentSchema;
